From adbc7ae6df22fd45c452a74c9bb4d4b12c3bfdda Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 22 Oct 2002 19:04:41 +0000 Subject: [PATCH] Start sketching in routing functions. --- gpsbabel/route.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/gpsbabel/route.c b/gpsbabel/route.c index 8365348cb..7614b8bd8 100644 --- a/gpsbabel/route.c +++ b/gpsbabel/route.c @@ -20,28 +20,57 @@ #include #include "defs.h" -static queue route_head; +static queue my_route_head; void route_init(void) { - QUEUE_INIT(&route_head); + QUEUE_INIT(&my_route_head); } + +route_head * +route_head_alloc(void) +{ + route_head *rte_head; + rte_head = xmalloc(sizeof (*rte_head)); + QUEUE_INIT(&rte_head->Q); + +} + + void -route_add(waypoint *wpt) +route_add_head(route_head *rte) { - ENQUEUE_TAIL(&route_head, &wpt->Q); + ENQUEUE_TAIL(&my_route_head, &rte->Q); + QUEUE_INIT(&rte->waypoint_list); } void -route_disp_all(waypt_cb cb) +route_add_wpt(route_head *rte, waypoint *wpt) { - queue *elem, *tmp; - waypoint *waypointp; + ENQUEUE_TAIL(&rte->waypoint_list, &wpt->Q); +} - QUEUE_FOR_EACH(&route_head, elem, tmp) { +void +route_disp (route_head *rh) +{ + queue *elem, *tmp; + printf("NEW ROUTE\n"); + QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { + waypoint *waypointp; waypointp = (waypoint *) elem; - (*cb)(waypointp); + waypt_disp(waypointp); + } + +} +void +route_disp_all() +{ + queue *elem, *tmp; + QUEUE_FOR_EACH(&my_route_head, elem, tmp) { + route_head *rh; + rh = (route_head *) elem; + route_disp(rh); } } -- 2.30.2